﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace EVEAPI.Account
{
	public class Characters : APIbase
	{
		private Character_Data[] _character_Data;

		public Characters(string keyID, string vCode)
			: base(keyID, vCode, @"https://api.eveonline.com/account/Characters.xml.aspx", true)
		{
			
		}

		protected override void LoadData()
		{
			_character_Data = new Character_Data[_rowSet.ChildNodes.Count];
			for (int i = 0; i < _rowSet.ChildNodes.Count; i++)
			{
				_character_Data[i] = new Character_Data();
				_character_Data[i].Name = _rowSet.ChildNodes[i].Attributes["name"].Value;
				_character_Data[i].CharacterID = int.Parse(_rowSet.ChildNodes[i].Attributes["characterID"].Value);
				_character_Data[i].CorporationName = _rowSet.ChildNodes[i].Attributes["corporationName"].Value;
				_character_Data[i].CorporationID = int.Parse(_rowSet.ChildNodes[i].Attributes["corporationID"].Value);
			}
		}

		public override bool Read()
		{
			return Refresh(new Hashtable());
		}
	}

	public class Character_Data
	{
		public string Name { get; set; }
		public int CharacterID { get; set; }
		public string CorporationName { get; set; }
		public int CorporationID { get; set; }

		public Character_Data()
		{
		}
	}
}
